<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>选项卡</title>
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    </head>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        img{
            width: 300px;
            height: 550px;
            display: block;
            float: left;
            margin-right: 4px;

        }
        li{
            float: left;
            
        }
        ul{
            overflow: hidden;
        }
        li input{
            width: 300px;
            margin-right: 4px;
        }
        div{
            width: 300px;
            height: 550px;
            display:inline-block;
        }
    </style>
    <script>
        fIn=function(){//显示
            $('img:eq('+sub+')').fadeIn(100)
        }
        fOut=function(sub){//隐藏
            $('img:eq('+sub+')').fadeOut(100)
        }
        $(function(){
            var div=$('div')
            var img=$('img')
            $('img:last').css('margin','0')
            $('img').hide()
            div.mouseover(function(){
                sub=parseInt(div.index($(this)))
                fIn(sub)
            })
            div.mouseleave(function(){
                sub=parseInt(div.index($(this)))
                fOut(sub)
                
            })
        })
    </script>
    <body>
        <ul id="img_ul">
            <div><img src="img/jk0.jpg" alt=""></div>
            <div><img src="img/jk1.jpg" alt=""></div>
            <div><img src="img/jk2.jpg" alt=""></div>
            <div><img src="img/jk3.jpg" alt=""></div>
            <div><img src="img/jk4.jpg" alt=""></div>
        </ul>
    </body>
</html>